import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SysRegionForm, SysRegionQuery, SysRegionVo} from '@/api/region/types';

/**
 * 查询【请填写功能名称】列表
 * @param query
 * @returns {*}
 */

export const listSysRegion = (query?: SysRegionQuery): AxiosPromise<SysRegionVo[]> => {
  return request({
    url: '/lawyer/sysRegion/list',
    method: 'get',
    params: query
  });
};

export const treeSysRegion = (query?: SysRegionQuery): AxiosPromise<SysRegionVo[]> =>{
  return request({
    url: '/lawyer/sysRegion/regionTree',
    method: 'get',
    params: query
  });
};

/**
 * 查询【请填写功能名称】详细
 * @param id
 */
export const getSysRegion = (id: string | number): AxiosPromise<SysRegionVo> => {
  return request({
    url: '/lawyer/sysRegion/' + id,
    method: 'get'
  });
};

/**
 * 新增【请填写功能名称】
 * @param data
 */
export const addSysRegion = (data: SysRegionForm) => {
  return request({
    url: '/lawyer/sysRegion/saveSysRegion',
    method: 'post',
    data: data
  });
};

/**
 * 修改【请填写功能名称】
 * @param data
 */
export const updateSysRegion = (data: SysRegionForm) => {
  return request({
    url: '/lawyer/sysRegion/updateSysRegion',
    method: 'post',
    data: data
  });
};

/**
 * 删除【请填写功能名称】
 * @param id
 */
export const delSysRegion = (id: string | number | Array<string | number>) => {
  return request({
    url: '/lawyer/sysRegion/removeSysRegion/' + id,
    method: 'delete'
  });
};

export const listDistrictShangHai = (): AxiosPromise<SysRegionVo[]> => {
  return request({
    url: '/lawyer/sysRegion/listDistrictShangHai',
    method: 'get'
  });
};
